package com.ecoolex.hotel.saas.enums;

import com.ecoolex.framework.common.EnumInterface;
import com.ecoolex.framework.common.util.Check;

public enum PresaleCouponOrderStatus implements EnumInterface<PresaleCouponOrderStatus, Integer> {
	WAIT_PAY(1, "待支付"), 
	WAIT_USE(2, "待使用"), 
	USED(3, "已使用"), 
	CANCEL(4, "已取消"),
	AUTO_CANCEL(5, "自动取消"),
	AFTER_SALES(6, "售后中"),
	CLOSE(7, "已关闭"),
	EXPIRED(8, "已过期");

	private int real;

	private String describe;

	private PresaleCouponOrderStatus(int real, String describe) {
		this.real = real;
		this.describe = describe;
	}

	@Override
	public Integer real() {
		return real;
	}

	@Override
	public String describe() {
		return describe;
	}

	@Override
	public PresaleCouponOrderStatus realOf(Integer real) {
		if (Check.notNull(real)) {
			for (PresaleCouponOrderStatus v : values()) {
				if (v.real().equals(real)) {
					return v;
				}
			}
		}
		return null;
	}
	
	public static Boolean canPay(Integer status) {
		return WAIT_PAY.equal(status);
	}
	
	public static Boolean canCancel(Integer status) {
		return WAIT_PAY.equal(status);
	}
	
	public static Boolean canRefund(Integer status) {
		return WAIT_USE.equal(status) || EXPIRED.equal(status);
	}
	
	public static Boolean canVerify(Integer status) {
		return WAIT_USE.equal(status);
	}
	
	public static Boolean canCancelVerify(Integer status) {
		return USED.equal(status);
	}
	
	public static Boolean canDel(Integer status) {
		return CANCEL.equal(status) || AUTO_CANCEL.equal(status) || CLOSE.equal(status) || EXPIRED.equal(status);
	}
}

